package factory;

import java.rmi.*;
import java.rmi.server.UnicastRemoteObject;
import adapter.IAdapter;

public final class Factory {
	static IAdapter adapter = null;

	public static IAdapter getAdapter(Remote anObject) {
		if (adapter == null) {
	        try{
	        	UnicastRemoteObject.exportObject(anObject, 0);
			    adapter = (IAdapter) Naming.lookup ("rmi://localhost:10990/Adapter");
	
			} catch (Exception e) {
				e.printStackTrace();
				System.exit(1);
			}
		}
		return adapter;
	}

}
